#!/bin/zsh
local 0=${(%):-%N}

${0}() {
  typeset -g curcontext=${WIDGET}:::
  local +h -a comppostfuncs=( ${(%):-%N}:post "$comppostfuncs[@]" )
  compstate[old_list]=
  autocomplete:_main_complete:new - history-lines _autocomplete__history_lines

  unset curcontext
  (( _lastcomp[nmatches] ))
}

${0}:post() {
  typeset -gi MENUSELECT=0
  compstate[insert]='menu:0'
}

${0} "$@"
